<?php
	require_once('../inc/fen_fns.php');
	
	sec_session_start();
	$pid = $_GET['pid'];
	
	if(login_check($mysqli, '>', '50') == true) {

						$query = $_DB->Query("SELECT
											fen_members.titr as titr,
											fen_members.name as name,
											fen_members.surname as surname,
											fen_members.username as username,
											fen_department.department_name as department_name,
											fen_faculty.faculty_name as faculty_name,
											fen_publications.yayin_tipi,
											fen_publications.yayin_turu,
											fen_publications.eser_adi,
											fen_publications.dergi_adi,
											fen_publications.volume,
											fen_publications.issue,
											fen_publications.sayfa,
											fen_publications.yayinevi_adi,
											fen_publications.doi_no,
											fen_publications.yayin_yili,
											fen_publications.yazar_sayisi,
											fen_publications.indeks_turu,
											fen_publications.sinif,
											fen_publications.kitap_adi,
											fen_publications.editor_adi,
											fen_publications.isbn_no
											from fen_members, fen_department, fen_faculty, fen_publications
											WHERE
											fen_publications.id = '".$pid."' and
											fen_publications.member_id = fen_members.id and
											fen_members.department_id = fen_department.id and
											fen_members.faculty_id = fen_faculty.id
											");
						
						
						if ($_DB->GetResultValue($query, "0", "status") == '0') {
							$status = "<font color=\"#dd0303\">Reddedildi</font>";
						} else if ($_DB->GetResultValue($query, "0", "status") == '1') {
							$status = "<font color=\"#f97b00\">Yeni</font>";
						} else if ($_DB->GetResultValue($query, "0", "status") == '2') {
							$status = "<font color=\"#539e3b\">Rekt√∂rl√ºƒüe G√∂nderildi</font>";
						}
						
						$sinif = $_DB->GetResultValue($query, "0", "sinif");
						if ($sinif) { $sinif = "(".$sinif.")"; }
						
						$cancel_reason = $_DB->GetResultValue($query, "0", "cancel_reason");
						if ($cancel_reason) { $cancel_reason = "(".$cancel_reason.")"; }
						
						$issue = $_DB->GetResultValue($query, "0", "issue");
						if ($issue) { $issue = "(".$issue.")"; }
						
						$yayin_tipi = $_DB->GetResultValue($query, "0", "yayin_tipi");
						
				
						
?>

<script type="text/javascript">


function cancelReason(obj) {  

	jQuery(document).ready(function($) {
		  $('a[rel*=facebox]').facebox() 

		  jQuery.facebox({ ajax: 'applications/application-cancel.php?pid='+obj })
	}) 
} 



</script>


	<div id="user_detailed_div">
<div id="user_detailed_head_div">
<p id="user_detailed_name">&nbsp;
<?php 
			
				echo $_DB->GetResultValue($query, "0", "titr")." ".$_DB->GetResultValue($query, "0", "name")." ".$_DB->GetResultValue($query, "0", "surname");
		
?>
</p>
</div>


<div class="summaryTableSmall2detailed2">

	<table id="appDetailedTable">
		<tr>
			<td id="appDetailedTD">Fakülte</td>
			<td id="appDetailedTD2a"><?php echo $_DB->GetResultValue($query, "0", "faculty_name"); ?></td>
		</tr>
		<tr id="appDetailedTR">
			<td id="appDetailedTD">Bölüm</td>
			<td id="appDetailedTD2"><font color="#0289b5"><?php echo $_DB->GetResultValue($query, "0", "department_name"); ?></b></font></td>
		</tr>
	</table>
	<br>
	<table id="appDetailedTable">		
		<tr id="appDetailedTR">
			<td id="appDetailedTD">Yayın Tipi</td>
			<td id="appDetailedTD2a"><?php echo $yayin_tipi; ?></td>
		</tr>
		<tr id="appDetailedTR">
			<td id="appDetailedTD">Yayın Türü</td>
			<td id="appDetailedTD2"><?php echo $_DB->GetResultValue($query, "0", "yayin_turu"); ?></td>
		</tr>
		<tr id="appDetailedTR">
			<td id="appDetailedTD">Yayın Yılı</td>
			<td id="appDetailedTD2"><?php echo $_DB->GetResultValue($query, "0", "yayin_yili"); ?></td>
		</tr>
		<tr id="appDetailedTR">
			<td id="appDetailedTD">Yazar Sayısı</td>
			<td id="appDetailedTD2"><?php echo $_DB->GetResultValue($query, "0", "yazar_sayisi"); ?></td>
		</tr>
		<tr id="appDetailedTR">
			<td id="appDetailedTD">Eser Adı</td>
			<td id="appDetailedTD2"><?php echo $_DB->GetResultValue($query, "0", "eser_adi"); ?></td>
		</tr>
		<?php if ($yayin_tipi == 'Makale') { echo "<tr><td id=\"appDetailedTD\">Dergi Adı</td><td id=\"appDetailedTD2\">".$_DB->GetResultValue($query, "0", "dergi_adi")."</td></tr>"; } ?>
		
		<?php if ($yayin_tipi == 'Makale') { echo "<tr><td id=\"appDetailedTD\">DOI No</td><td id=\"appDetailedTD2\"><a target=\"_blank\" href=\"http://dx.doi.org/".$_DB->GetResultValue($query, "0", "doi_no")."\">".$_DB->GetResultValue($query, "0", "doi_no")."</a></td></tr>"; } ?>
		
		<?php if ($yayin_tipi == 'Makale') { echo "<tr><td id=\"appDetailedTD\">Volume / Issue</td><td id=\"appDetailedTD2\">".$_DB->GetResultValue($query, "0", "volume")." ".$issue."</td></tr>"; } ?>
		
		<?php if ($yayin_tipi == 'Makale') { echo "<tr><td id=\"appDetailedTD\">İndeks / Grup</td><td id=\"appDetailedTD2\">".$_DB->GetResultValue($query, "0", "indeks_turu")." ".$sinif."</td></tr>"; } ?>
		
		<?php if ($yayin_tipi == 'Kitap Bölümü') { echo "<tr><td id=\"appDetailedTD\">Kitap Adı</td><td id=\"appDetailedTD2\">".$_DB->GetResultValue($query, "0", "kitap_adi")."</td></tr>"; } ?>
		
		<?php if ($yayin_tipi == 'Kitap Bölümü') { echo "<tr><td id=\"appDetailedTD\">Editör Adı</td><td id=\"appDetailedTD2\">".$_DB->GetResultValue($query, "0", "editor_adi")."</td></tr>"; } ?>
		
		<?php if ($yayin_tipi == 'Kitap Bölümü' || $yayin_tipi == 'Kitap') { echo "<tr><td id=\"appDetailedTD\">ISBN No</td><td id=\"appDetailedTD2\">".$_DB->GetResultValue($query, "0", "isbn_no")."</td></tr>"; } ?>
		
		<tr>
			<td id="appDetailedTD">Sayfa Sayısı</td>
			<td id="appDetailedTD2"><?php echo $_DB->GetResultValue($query, "0", "sayfa"); ?></td>
		</tr>
		<tr>
			<td id="appDetailedTD">Yayınevi Adı</td>
			<td id="appDetailedTD2"><?php echo $_DB->GetResultValue($query, "0", "yayinevi_adi"); ?></td>
		</tr>
		
	</table>
	<br>	
				
</div>

<?php 
	} else {
		header('Location: ./index.php?error=2');
	}

?>